Implemented transition and match functions and unitary tests.