Uses case statement instead of nested if