included weighted average algorithm