writing some logic for conflict resolution