refactored pilot