Add debug flag, chomp and a few docstrings.