Cleaned debug code and documented changes.