refactor route handle