Allow modifying notes, add some tests, fix bugs