Better check of input string