Set up state handler.