Added comments.
Removed debug io:write statements.