seems to be working, not extensively tested
fix a few bugs that kept a merge of add followed by remove from working