added logic to enforce that a note or rest can only be overwritten by a note of equal or lesser duration