refactor layout mess