We begin by proving that the class of problems accepted by the program schemes of NPS is exactly the class of problems defined by the sentences of transitive closure logic (program schemes of NPS are obtained by generalizing basic non-deterministic while-programs whose tests within while instructions are quantifier-free first-order formulae). We then show that our program schemes form a proper infinite hierarchy within NPS whose analogy in transitive closure logic is a proper infinite hierarchy, the union of which is full transitive closure logic but for which every level of the hierarchy has associated with it a first-order definable problem not in that level. We then proceed to add a stack to our program schemes, so obtaining the class of...