Simplify layout code