Logic refinement