code cleanup finished, and VT100 fixes