wrote take function