Changes to JS

Implementing OOP behaviour