Changed command -> which and added emacs support