updated with backspace changes and initial error fix