code cleanup for sync process