Import of unfinished 2012 script I wrote, import to fix.