move if/else to switch for readability
Merge pull request #1265 from CharlieMarshall/switch