More simplification inspired by eb47a2700137f092af33251eccc051860e3242d2.