WIP: Migrate to Appframework

Requires more work - see inline comments