source code re-organized for CUDA project