fixed recursion related memory leak, by removing recursion :)