Improved curl queries and exception catch