Small cosmetic fixes.
Refactor app creation, add tests.