changed if/then/else to switch