tidy code
fix tests