Cleaned up Multi-Machine code with an eye towards solving certain edge cases that would break the underlying logic.