refactor and add router