working on records in groups