Reorganize GUI code;
Some cleanup;