removed debug output, improved comments