Major refactor to simplify app structure.