rebuildanal_helper has all the functions