VE-533: refactor duplicate code into mixins.