Massive refactor: Mostly to remove ambiguity of the term 'app'.