Refactoring CBLayout