Changed syntax for grid layouts and refined code for smaller file sizes