ugly if statements now case statements