working except for recursive