Refactor

In the midst of converting our javascript code into a more object oriented code!