added cache optimalization