Added extend function to prototype.