Fix tests and clean up