updated to have customized exceptions