new tests, and code cleaned