Use unique File and Transaction Group References

This is mostly about #104; but it also fixes a number of related issues along the way.