refactor route-getting for generate