Added custom fail callback option.
Undoing previous commit.