finished UI code