Refactor receiver of Leap processing code