Iteration 3 half-way

Stuck with sample caching