Fixed getNeighbour query, added unit tests to validate.