Extracted some logic to mixins