base code from ci and datammaper