Adds more tests and debug output to the script.