Adding implementation to handle backspace