rough backspace support, this is getting too complex, needs unittests and refactor...