refactor notes js