Changed record_everything for a filter function, which is more flexible.