added keydown function