Added input check.