Debug Algorithm