Changed ridiculous if/else to a switch

This doesn't change function just improves readability