added a timedelay for statetransitions