implement take function