Optimized backspace key function