Refactoring to packages