this is actually just a script I stole from somewhere; hopefully someday I'll understand it better.

index