Moved error check for total arguments up