update state logging, code clean up