refactoring brick connect