A more generic implementation. It leaks resources because it uses a leaking readGroupNamesFid function (as proved by tests).