refactoring switch brick