First checkin of the working script. Barely does what it's supposed to do, but
it works.