More efficient updating

Previously all the object instances to be updated were fetched at once. This can be a memory problem, if there are many big objects to be updated. More efficient is to fetch them in batches.