factor logic into mixins