Added try clauses to handle exceptions