Refactoring AIP request handler.