interaction between key presses and view, and general bug fixing