Moving stuff to a lib + work on parallel grid search