Improvement of the thermoelectric properties of GeTe- and SnTe-based semiconductors aided by the engineering based on phase diagram