rework logic