Added check if sqaure cursor is on grid and method for getting coordinates from the grid