Refactor NoteSet module to be a simple factory function