Used switch statement to process commands.