Added IllegalArgumentException rather than allowing NPEs