#1028 Rewrite menu function