added state tracking