Support RESV controls

This is a fairly large PR. The implementation is by @bska, it has been reviewed and tested to not-ruin-the-spe-cases by me and the REESV feature has been tested (by @osae). Merging should be quite non-controversial. I'd appreciate a check that it still builds and works though, since there have been quite a few changes recently.