add layout logic