This adds a weird callback-based system to properly update the state once a note is removed.
This system isn't very nice, and it can be quite messy, but I'll improve it in the future
This is an initial release, I'm aware that this doesn't have the best structure and that there's lots of copying, but performance isn't relevant right now