Semi-initial commit.

Lacks error-reporting. And probably other stuff.