Updates to pull request that was closed

I have moved the updates from the main file and moved them to the grid* that I could find the corresponding functions in.