Reduce duplicated layout code