Implements distance #296