Factorize main menu