Cleaned up install_app

Major cleanup in install_app, refactored several different checks for required elements into one function.