refactoring, if else -> switch case