tests merge and refactor