refactor
refactored if statements