refactor menu js