documentation for inference.py and other doc refactorings