major refactoring of the records