If there is invalid input, the function returns `null` - throw valid exceptions instead.
If there is invalid input, the function returns
null- throw valid exceptions instead.