Cleaned and ported code to parse report records