General cleanup, plus fixing VI-input insert mode bug