Fixed some Findbugs errors.
Added integration tests.