Optimized speed and fixed caching algo