copied in code from live site

as written by thisismattmiller, last updated 2013-03-29