Refactor complex blocks into mixins