added more efficient weighted_choice method