long if/else block to switch statement