refactoring compareService