wrote own extend function