main: move most of main to app, separate ownership