added manage_app helper and some clean up