Fixing unit tests, cleanup