Added a bunch of debug printfs.