Test for tail recursion is in.
documents end up in resultant array
import optimization