Cleaned up the script, and removed a bit of debug printing.