Got writing of metadata and errors working.