Refactor keyboard control. Remove unnecessary call to expandTree.