Touched up the create_app function and the various related functions