Made changes to JS

Attempted to change javascript to be intuitive