extract request_handler (unfinished)