Converted if statment into a switch statement.