significant refactoring of extempore.el

mainly to support different connection types more robustly