Replaced if-sequences with case statements