Fix endl's.
Add key codes functions. Add mouse event handlers. Add loop control functions.