Changes doc format to rst so it can be generated locally.
Adds mostly internal documentation.