Merge branch 'sb/refs-code-cleanup'