added finit state machines