refactor based on MateUnity