Added some comments and minor fixes.
Added failure message propagation.