Added code to update collection stats