refactored backspace. fixed BS current_len <0. refactored diag().