updated the algorithm for locating points, still buggy for dot plots