router api implementation

First phase of router API.