diff --git a/screen_ui.cpp b/screen_ui.cpp
index d3f373e..56ca48e 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -52,14 +52,23 @@
   return tv.tv_sec + tv.tv_usec / 1000000.0;
 }
 
-Menu::Menu(bool scrollable, size_t max_items, size_t max_length)
+Menu::Menu(bool scrollable, size_t max_items, size_t max_length, const char* const* headers,
+           const char* const* items, int initial_selection)
     : scrollable_(scrollable),
       max_display_items_(max_items),
       max_item_length_(max_length),
-      text_headers_(nullptr),
+      text_headers_(headers),
       menu_start_(0),
-      selection_(0) {
+      selection_(initial_selection) {
   CHECK_LE(max_items, static_cast<size_t>(std::numeric_limits<int>::max()));
+
+  // It's fine to have more entries than text_rows_ if scrollable menu is supported.
+  size_t max_items_count = scrollable_ ? std::numeric_limits<int>::max() : max_display_items_;
+  for (size_t i = 0; i < max_items_count && items[i] != nullptr; ++i) {
+    text_items_.emplace_back(items[i], strnlen(items[i], max_item_length_));
+  }
+
+  CHECK(!text_items_.empty());
 }
 
 const char* const* Menu::text_headers() const {
@@ -85,7 +94,7 @@
 }
 
 bool Menu::ItemsOverflow(std::string* cur_selection_str) const {
-  if (!scrollable_ || static_cast<size_t>(ItemsCount()) <= max_display_items_) {
+  if (!scrollable_ || ItemsCount() <= max_display_items_) {
     return false;
   }
 
@@ -94,19 +103,6 @@
   return true;
 }
 
-void Menu::Start(const char* const* headers, const char* const* items, int initial_selection) {
-  text_headers_ = headers;
-
-  // It's fine to have more entries than text_rows_ if scrollable menu is supported.
-  size_t max_items_count = scrollable_ ? std::numeric_limits<int>::max() : max_display_items_;
-  for (size_t i = 0; i < max_items_count && items[i] != nullptr; ++i) {
-    text_items_.emplace_back(items[i], strnlen(items[i], max_item_length_));
-  }
-
-  CHECK(!text_items_.empty());
-  selection_ = initial_selection;
-}
-
 // TODO(xunchang) modify the function parameters to button up & down.
 int Menu::Select(int sel) {
   CHECK_LE(ItemsCount(), static_cast<size_t>(std::numeric_limits<int>::max()));
@@ -987,9 +983,8 @@
                                  int initial_selection) {
   pthread_mutex_lock(&updateMutex);
   if (text_rows_ > 0 && text_cols_ > 1) {
-    menu_ = std::make_unique<Menu>(scrollable_menu_, text_rows_, text_cols_ - 1);
-    menu_->Start(headers, items, initial_selection);
-
+    menu_ = std::make_unique<Menu>(scrollable_menu_, text_rows_, text_cols_ - 1, headers, items,
+                                   initial_selection);
     update_screen_locked();
   }
   pthread_mutex_unlock(&updateMutex);
diff --git a/screen_ui.h b/screen_ui.h
index b0cbbdb..3b309fb 100644
--- a/screen_ui.h
+++ b/screen_ui.h
@@ -33,7 +33,10 @@
 // This class maintains the menu selection and display of the screen ui.
 class Menu {
  public:
-  Menu(bool scrollable, size_t max_items, size_t max_length);
+  // Constructs a Menu instance with the given |headers|, |items| and properties. Sets the initial
+  // selection to |initial_selection|.
+  Menu(bool scrollable, size_t max_items, size_t max_length, const char* const* headers,
+       const char* const* items, int initial_selection);
 
   bool scrollable() const {
     return scrollable_;
@@ -45,8 +48,10 @@
 
   // Returns count of menu items.
   size_t ItemsCount() const;
+
   // Returns the index of the first menu item.
   size_t MenuStart() const;
+
   // Returns the index of the last menu item + 1.
   size_t MenuEnd() const;
 
@@ -68,10 +73,6 @@
   // |cur_selection_str| if the items exceed the screen limit.
   bool ItemsOverflow(std::string* cur_selection_str) const;
 
-  // Starts the menu with |headers| and |items| in text. Sets the default selection to
-  // |initial_selection|.
-  void Start(const char* const* headers, const char* const* items, int initial_selection);
-
   // Sets the current selection to |sel|. Handle the overflow cases depending on if the menu is
   // scrollable.
   int Select(int sel);
diff --git a/tests/unit/screen_ui_test.cpp b/tests/unit/screen_ui_test.cpp
index be6799f..9c123e8 100644
--- a/tests/unit/screen_ui_test.cpp
+++ b/tests/unit/screen_ui_test.cpp
@@ -24,10 +24,8 @@
 constexpr const char* ITEMS[] = { "items1", "items2", "items3", "items4", "1234567890", nullptr };
 
 TEST(ScreenUITest, StartPhoneMenuSmoke) {
-  Menu menu(false, 10, 20);
+  Menu menu(false, 10, 20, HEADER, ITEMS, 0);
   ASSERT_FALSE(menu.scrollable());
-
-  menu.Start(HEADER, ITEMS, 0);
   ASSERT_EQ(HEADER[0], menu.text_headers()[0]);
   ASSERT_EQ(5u, menu.ItemsCount());
 
@@ -41,10 +39,8 @@
 }
 
 TEST(ScreenUITest, StartWearMenuSmoke) {
-  Menu menu(true, 10, 8);
+  Menu menu(true, 10, 8, HEADER, ITEMS, 1);
   ASSERT_TRUE(menu.scrollable());
-
-  menu.Start(HEADER, ITEMS, 1);
   ASSERT_EQ(HEADER[0], menu.text_headers()[0]);
   ASSERT_EQ(5u, menu.ItemsCount());
 
@@ -59,10 +55,8 @@
 }
 
 TEST(ScreenUITest, StartPhoneMenuItemsOverflow) {
-  Menu menu(false, 1, 20);
+  Menu menu(false, 1, 20, HEADER, ITEMS, 0);
   ASSERT_FALSE(menu.scrollable());
-
-  menu.Start(HEADER, ITEMS, 0);
   ASSERT_EQ(1u, menu.ItemsCount());
 
   std::string message;
@@ -76,10 +70,8 @@
 }
 
 TEST(ScreenUITest, StartWearMenuItemsOverflow) {
-  Menu menu(true, 1, 20);
+  Menu menu(true, 1, 20, HEADER, ITEMS, 0);
   ASSERT_TRUE(menu.scrollable());
-
-  menu.Start(HEADER, ITEMS, 0);
   ASSERT_EQ(5u, menu.ItemsCount());
 
   std::string message;
@@ -95,10 +87,8 @@
 }
 
 TEST(ScreenUITest, PhoneMenuSelectSmoke) {
-  Menu menu(false, 10, 20);
-
   int sel = 0;
-  menu.Start(HEADER, ITEMS, sel);
+  Menu menu(false, 10, 20, HEADER, ITEMS, sel);
   // Mimic down button 10 times (2 * items size)
   for (int i = 0; i < 10; i++) {
     sel = menu.Select(++sel);
@@ -126,10 +116,8 @@
 }
 
 TEST(ScreenUITest, WearMenuSelectSmoke) {
-  Menu menu(true, 10, 20);
-
   int sel = 0;
-  menu.Start(HEADER, ITEMS, sel);
+  Menu menu(true, 10, 20, HEADER, ITEMS, sel);
   // Mimic pressing down button 10 times (2 * items size)
   for (int i = 0; i < 10; i++) {
     sel = menu.Select(++sel);
@@ -157,10 +145,8 @@
 }
 
 TEST(ScreenUITest, WearMenuSelectItemsOverflow) {
-  Menu menu(true, 3, 20);
-
   int sel = 1;
-  menu.Start(HEADER, ITEMS, sel);
+  Menu menu(true, 3, 20, HEADER, ITEMS, sel);
   ASSERT_EQ(5u, menu.ItemsCount());
 
   // Scroll the menu to the end, and check the start & end of menu.
diff --git a/wear_ui.cpp b/wear_ui.cpp
index e4473ba..d21f835 100644
--- a/wear_ui.cpp
+++ b/wear_ui.cpp
@@ -93,8 +93,7 @@
   pthread_mutex_lock(&updateMutex);
   if (text_rows_ > 0 && text_cols_ > 0) {
     menu_ = std::make_unique<Menu>(scrollable_menu_, text_rows_ - kMenuUnusableRows - 1,
-                                   text_cols_ - 1);
-    menu_->Start(headers, items, initial_selection);
+                                   text_cols_ - 1, headers, items, initial_selection);
 
     update_screen_locked();
   }
