refactoring race system