Initial commit. Untested due to tmpdir awkwardness.