Cleaned up and added some tests.  Also added some functionality to handle array type state transitions (in addition to the existing Event transition handler)