working version but too deep recursion
WORKS