function create route improved