Switch to more data-driven UI

UI now less hardcoded, and a bit less hacky overall. Still has a few
issues.