wrapped all in a try and catch