replace atoi with std::stoi (new in C++-11)