Flatdoc Revision

Provided a working flatdoc version for further development.