refactored mix_result function family