small layout code refactor