var utils   = require('radiodan-client').utils,
    logger  = utils.logger(__filename);

module.exports = function(handlers) {
  return {
    'startPlaying': function(service) {
      var self = this;
      logger.info('startPlaying');

      handlers.playing.start(service).then(function(){
        self.handle('startAnnouncing');
      });
    },
    'startAvoiding': function(settings) {
      logger.info('startAvoiding');
      this.transition('avoidingAnnouncing');
      this.handle('startAvoiding', settings);
    },
    'startAnnouncing': function(settings){
      logger.info('startAnnouncing');
      handlers.announcing.start(settings);
    },
    'stopAnnouncing': function(){
      handlers.announcing.stop();
      this.transition('playing');
    },
    'standby': function() {
      logger.info('standby');
      this.transition('standbyAnnouncing');
      this.handle('standby');
    },
    '*': function(payload) {
      logger.warn('unknown', payload);
      this.emit('error', new Error('Unhandled', payload));
    }
  };
}

@@ -349,28 +349,30 @@
 %0A    'startA
-void
+nnounc
 ing': functi
@@ -407,28 +407,30 @@
 info('startA
-void
+nnounc
 ing');%0A     
@@ -434,82 +434,34 @@
     
-this.transition('avoidingAnnouncing');%0A      this.handle('startAvoiding', 
+handlers.announcing.start(
 sett
@@ -473,35 +473,34 @@
 ;%0A    %7D,%0A    'st
-art
+op
 Announcing': fun
@@ -505,25 +505,18 @@
 unction(
-settings
 )
+ 
 %7B%0A      
@@ -522,35 +522,34 @@
  logger.info('st
-art
+op
 Announcing');%0A  
@@ -570,36 +570,61 @@
 nnouncing.st
-art(settings
+op();%0A      this.transition('playing'
 );%0A    %7D,%0A  
@@ -624,33 +624,32 @@
   %7D,%0A    'st
-opAnnounc
+artAvoid
 ing': functi
@@ -655,76 +655,144 @@
 ion(
-)%7B%0A      handlers.announcing.stop();%0A      this.transition('playing'
+settings) %7B%0A      logger.info('startAvoiding');%0A      this.transition('avoidingAnnouncing');%0A      this.handle('startAvoiding', settings
 );%0A 

Reorder PlayingAnnouncing state