Fixes for the notes and more work on the optimizer