added check for space/backspace and some control variables