refactoring RPS p2