refactoring in layout page system