REL-1501: Massive cleanup of TPE menu code.