refactor if to switch
refactored statements if to switch in order to create cleaner code