new version
added validaion on input