Replaced switch statements with if-else