Object Oriented JS Refactoring