Imported from https://github.com/weitechen/anafora