implement functions: take-while, remove