Added checking for illegal arguments.