Better cite-completions

These are the same changes from #422, but done with a clean history so that it can be pulled without affecting anything other than citation completions.