changed recursion to fold_left
added test with wrong answer