! 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.
! Changing public API to make it run without wand.