move to a prototype and mixin function model