working on extend function