CS373: new structure for main gradient descent code