added extend
added extend function and made tests pass