Initial implementation, untested and undocumented.