Added grid, factored out stuff in draw to make it more readable.