Divide gui and logic. Refactoring.
Merge remote-tracking branch 'origin/master'