completed UI code