Snippet of code in response to StackOverFlow question