Change AddRoute signature to use ep structs, factor out functions for testability, add unit tests for said functions