Added a basic implementation of Gradient Descent.

Refactoring the code.