Added a function to check if a location is within the grid