Changed if/else nesting to switch/case statement. It should run faster and looks cleaner