brick flow refactoring