solve backspace char functionality removed; edge cases solved by a
different approach.