Put everything into a 'where', except for Graphical stuff, which is commented out.
A small amount of cleaning up for indented version so it is somewhat presentable.
Added more comments. Before submitting, remove TODO and maybe fix that comment
Updated comments and made some tiny refactors (mostly name changes). INCLUDING test stuff
Removed test stuff