SZdist refactor