some refactoring to accomodate splitting records.