major overhaul and emacs stuff