Minor refactoring to remove redundant code