This is already copy-pasted several places. It should go into a new mixin instead.