Modified logreg.py