Used case statements to improve readability.