refine the layout