lots of cleanup, and improve the UI a bit