Changed the implementation to prototypical inheritance to work with jasmine