Refactoring and app structure