Reln refactor

Pure refactoring of "internal" relational query components.