added more tests and changed exception being raised