looks like we are double-matching for some cases, would it be worth optimizing?
otherwise success should probably be defined before failure