refactored record factory; moved into classes