replaced switch statement