updated script to install more packages and added error checking