added a flag for controlling background collection