Removing duplication of records parsing code