Added some new functionality for key presses and fixed several sloppy implementations.