cleaned up formal model, changed statediagram again to reflect specific changes