Revised GPU version