Major cleanup. Adapt to PEP8. Generates .pdf instead of .tex