implemented basic version of grid layout