minor edits to base sgd function