Pull Request for Optimization

This implemented a better caching than the original versions.  It now only requests data when it needs to and only computes data when it needs it.