Moved instruments_cache to function