Completed OpenCL rewrite