refactored code in reconcile