lots of cleanup to emacs