refactoring to be prototypal compliant