refactoring of service, created smaller helper classes to create automated tests