Fixed some scoping issues and made recursion usable. Also clarified defined method variable usage.