corrected segv on end_functions, due to bad attribute(destructor) order changed OpenCl data
structures to C++ containers. still some changes to do but code is working.