InferenceMachine refactored