nicer test output and refactor