added reference to the StackOverflow answer for future reference (and to give credit)