Added thrust and replaced sum with thrust sum.