Some arrow key handling. Refactoring.