Memory level LRU and some code cleans