Tag demulsifier program optimization