Refactor router api