Added recursion algorithm - currently broken