Copied and pasted without noting the license that stack overflow has on code published there, no doubt