Made the grid visibility be controlled in a better way, removed some debug code.