init router logic