Code cleanup in layout