refactor test, reduce code