Fixed the cuda style implementation. CPU now works and GPU scaffolding is in place (although not quite working yet).