Adding exceptions for invalid arguments.