Lots of changes

Refactored to put more into the UI class. Added pen, download and  a
basic undo/redo system.