Replaced IOException with IllegalArgumentException