Imported from https://github.com/laurago894/HwAwareProb