refixed note-clipping bug; simplified code