clean up UI code a bit