added local stream options, optional logging, and nicer disconnect