implemented c version of datacube module