added cache stuff to separate class