Refactoring of code organization and better data encapsulation