Implemented integration tests. Small fixes.