moved LRU into a function