Functional bug fixes and jsLint validation

Functional bug fixes and jsLint validation