added CheckInput Function