more work, save state work, some cleanup still need some work
some small changes