Added try catch to program as a precaution.