Script cache

Added Caching to scripts.
Instead of iterating in linear time, why not store the cache in a std::map ? Then we could perform O(1) lookup