Reworked guard comparison

This is just a re-PR of accidentally closed #2015.
(Though I guess it's getting into v2 since 1.7.5 is promised to be the last of the 1.x series :)