added cache and buffer