moved some static variables into state (nw)