note.js: copied in a clean branch