Refined method for validating input

Well, nothing more, really… It is not even worth this version, and
still lacks tests