Added parallel version
Improved type stability
Removed benchmark
Refactored gradient function