improve cache management and some other points