added statemachine and email notifier