listen on input and filter out invalid data