refactor request handler a tiny bit