refactored Machine