Allow writer to be set

Reincarnation of #93 with suggestions made.

Closes #101.