wrapped the main body in a try and except clause to handle errors with a printout