Add tests and fix various stuff in causes