Corrected code for record processing again