Added try and catch