Swap out material for writing functions; fixes #4