applied try and catch