use cache for cps2
some refactoring