Added memory-efficient function evaluation.