added comment and attribution to StackOverflow