changed if/else to switch statement