Better figures, polished code

Little fixes mostly related to images and diagrams. Also added some explanatory lines alongside the Python code.