cleaned up 2 cuda functions