cleanup dead code
fix tests