Improved debug comments and documentation.