Loop until all the notes downloaded. Improve the way open and write catalog