Calculating grid by Atharva Pardikar | ScratchStats