cleanup code for state recording words