Sped up some feature functions with caching.