Added rudimentary caching.