First stab. Untested.