some layout code cleanup