Adding try and catch