Code comments; clean up document.py