Added some failure catching.