weighted average implemented