Aggressive caching.

Closes #505.