Rtefcst - first part of xray re-alignment

This branch is a merge between your most recent master (9dcc88a) and wpfcst / the old pull request (791830e). The immediate merge conflicts are resolved but the re-alignment with xary will take some more work. Not ready to be merged yet; I opened the PR so we can discuss some of the changes that also affect your previous code and move this branch forward (will comment on diff).