Changed Server so that it only writes results to file in batches of size at most 10 000.