Code refactoring. Added something like View-Controller