Added error catching for IllegalArgumentException.