change the name of "state" to "memory"
add definition for tid