Initial import

This is my first push of code to GitHub, made as a pull request for easier review
Hmmm, that's interesting. Is this to protect against two SWs, with versions _N_ and _N_+1, both in waiting state, being activated one right after another? To make sure that if something was prefetched in _N_+1 it isn't clobbered in the `activate` handler for version _N_?

I hadn't thought about that sort of race condition before. It sounds plausible, though I wonder how likely it would be to crop up in practice. (What I've done in the past is just match on specific versions and delete anything that isn't that version, but your approach sounds more robust.)