Cleaned up code using switch statement instead of if-else