refactor test system