added linenoise for line editing, a few bug fixes, cleaned up measurement code