updated for emacs mode, swap up/down