Dialyzer/Xref cleanup

Still a couple of Dialyzer warnings, see the e0e945b01918024442ad66832207682fb483e48e commit message to see details of the dialyzer stuff.