added pseudo-code and documentation for co-references