Fixed integration tests

Also fixed some code reviews.