Refactoring obj.js