lots of bug fixes for note extraction code