added documentation and fixed emacs script