Added some exceptions to handle illegal arguments.