fix tests, cleaning code