added exceptions for illegal arguments