integration refactoring

copy/paste maybe, will be fixed