Adding function to get the starting point and ending point