Fixed bugs with the "not close enough" code