Can handle md files, plus many logic fixes.

Figure and cache name mangling has changed from delimeter of _ to __