Merge pull request #25 from dimagi/cz

small refactor
use SafeSaveDocument