abstract mixin generation logic, add more helper functions