added else condition for invalid input