added auto checks for state changes