refactored to include JS-OOP best practices