added a try: else: statement to take into account where there is no data present.