Changed if/else/if/else... to switch statement