Refactoring and added number of threads used by OpenMP to be read from preferences file.