Add libraries, refactored 2D Fitting related code