Moved key stuff into app file