Consolidated code and documentation

Consolidated code structure, updated and added code documentation to allow generating a proper documentation using JSDuck.
That dash again. But doesn't matter.