replace atoi with std::stoi (new in C++-11)
 minor improvement on OpenMP parallelization
cleanup and polishing