Remove test output and trailing spaces