Logging added to state change