Added stdexcept to existing code