Refactored code to make recursion possible
Fixed merge conflict