refactor main layout