Implemented a complete state machine for guiding the user through all
the trials. General transition between multiple trials added.