#15 refactored if statements