switch statement in callback instead of if-else branching.