Added exception catching  for file format and location