Extracted a method for getting the y_coordinates