Main layout refactor