fitting.py drastically extended