Refactor notes code to work with recent site changes