refactored large parts of app structure