Moved c++ preprocessing to python code