This module sounds great, and it is encouraging to see the simpletest.

Before trying this out I'm reviewing the code, and am having to work too hard to understand what is going on. Ideally, the terms "magic" and "tricky" wouldn't appear in the code or they would be explained in a comment. A README.txt would be very helpful also.

I'm looking forward to trying this out!