Added func build_seg_refs_lookup_table()
Sorted writing of avg hways by dir after serv period
Fixed wrong dirs being written in assign avg hways func.
Removed unneeded import
Fixed problem where segs weren't having ext routes recorded.
Updated to match new read hways API