Added new functions, updated documentation, improved code-readability using JSLint