Editied thrust.cu for readablilty