Finish the algorithm of the function removePoint