Cleaned up application_install function.