! Fixed contains test being incorrect.
! Rewrote distance function to be more readable.
! Fixed sort function returning a True/False value instead of an integer value.