formatted and added a switch statement