UI refactoring: preload data, better globals, lots of cleanup and speedup
#133 this is a temporary commit, will be rebased/squashed/edited