moving all relevant variables into state