modify and add test cases for state changes