This prevents double slashes that can mess up path comparisons in some cases.
Added namespaces so that JSDoc can find them. Fixed a few warnings. Improved some comments.