replace case statements with if statements