add some sate control code.