clean up some layout logic