input listener improvement