minor edits to sim_sgd function