(menu_common_backend.c) Refactor some code