Refactoring application and packages