fix gui bugs
rework logic for practical use, WARNING Experimental