Move menu handling to a separate class.