WIP - rewrite app handling