Moving code to the enter and exit segments of each substate.
Adding missing semicolns.
Making use of the delete operator to properly keep the prototype of AsmState clean throughout.