added grid search to sgd.py, other modifications minor