Added debugging.
Further edits, updates and modifications.
Various bits of debugging.
Fixed some of the bugs and removed some of the extraneous debugging statements.