did a recursive function with teddy