layout code, little modify