Switch to a switch statement in the main to avoid unnecessary duplication