Text editor improvement

Also added clearing old variables from toolbox when switching kits