added weighted average to constructor