Fix math
Move grid rendering to sandbox.html