added state control