Moved more position/size logic into the layout