refactored statements if to switch in order to create cleaner code
Last refactoring