Saving states

we should merge this!