moved tok flags into state