Overhaul UI code to make it more flexible and less redrawing, little hierarchy framework