refactoring processing of pilot records and resources