Added temporal distance queries, other improvements