some layout refactoring