using std::invalid_argument for exceptions