Fix some UI code. Lots of work still to be done.