Basic implementation, untested.

This reverts commit 90a2ac71b7153b6b83583f01e0f2e4244ea65ef1.