Updated to work correctly - tested against getting a machine