Changed if to case statements