cleanup layout func