Refractor misc menu code