refactor and improve top/bottom menu