added arrow key recognition