Changed the representation of states to allow for any information in final state.
Changed comments and renamed parameters to reflect new representation.