changed impl to a more prototypal approach and added som functionality and tests