Moved code out of UsefulSnippets and put it where it is being used