updates to tests and proper distance calculation