Cleaner basename implementation.
Skip colinear points.