update for 3 states
add calibration mask