new handle request function refactor