move state into top level thingy