added test for recursive implementation