added a bunch of debug statements