Refactoring OpenCL Routines