Move the "handle record" instructions to a separate routine.