refactoring compare smartly module