Fix typos.
Add function to write basic header.
Implement up to write statements.

Not yet convinced about dict-based solution to issue of string labels.