Added better error output with excpetion handling
Fixed race condtion where status was set before output, etc