Adding try catch block