roles now broken out of monolithic structure. Changed machine logic to get past some edge cases where it would fail.