Split files, add some integration tests