add appropriate exceptions for invalid arguments.  + tests