refactor conditionals to use case statement.