For route calculating functions