More work on writing. Still not quite working.