Refactor calculations into utility class
Separate integration into a function
Update tests withe refactoring changes