Added optional support for CUDA