refactoring: if/else -> switch