This may be over-engineered, but it gives me an idea for an under-engineered version.

Neil