add xref blocks, minor refactors