adjust grid layout code