Made try and catch nicer rather than having two trys.