Weighted choice function added.