Simplified a bit the cuda implementation