refactored out the else