quite close to making integration working!