replace powerset calculation