refactoring ps2