added some helpers to make into c/python package