Initial, but untested, working code.