port of ST r-snippets