added condition for state