Basic infrastructure for writing the routing algorithm