added more documentation and fixed several bugs

(needed cuInit(0)) and also fixed the memory handling to use ArrayBuffers