Please add comments to the code why this is ok (i.e. it's efficient becasue it comes from a globla that's only recomputed when something changes)