Refactoring.
Some improvements in TS-GUI.