input detection added