rewrote reactor state controller.