Merged new layout code.