Added docs, removed debug printing.