Refactoring in logic package.
Refactoring in ui package.