Started to document flags.

Moved modFlags, createFlags and saveFlags out of their related classes
so that they could in future be exported by the API, and started to
document them.