Major refactoring, cleaner code.  Also catching keyboard interrupts and showing the trajectory of the cost function.
Merging