now handles backspace and auto resize