Cleanup + fix tests