Implemented arrow key handling