Added try-catch block