Updated for CUDA 6.0