Refactor app_processor to be slightly saner