integration refactoring

I do not need it, the logic was like that, I just implement the method, some of the changes can be improved