added state plotting