refactoring unneeded switch case