Now updates route when cost is updated

Also added some comments for the array structures.