state variable works