\code{
\func{POP}{\var{initial{\ac}goal{\ac}operators}}{\var{plan}}
\bodysep
    \setq{\var{plan}}{\prog{Make-Minimal-Plan}(\var{initial{\ac}goal})}
    \key{loop do}
          \key{if} \prog{Solution?}({\ts}\var{plan}) \key{then return} \var{plan}
          \setq{$S_{need}, c$}{\prog{Select-Subgoal}({\ts}\var{plan})}
          \prog{Choose-Operator}({\ts}\var{plan{\ac}operators}{\ac}$S_{need}${\ac}\var{c})
          \prog{Resolve-Threats}({\ts}\var{plan})
    \key{end}
\fnsep
\func{Select-Subgoal}{{\ts}\var{plan}}{$S_{need}, c$}
\bodysep
    pick a plan step $S_{need}$ from \noprog{Steps}({\ts}\var{plan})
          with a precondition $c$ that has not been achieved
    \key{return} $S_{need}, c$
\fnsep
\proc{Choose-Operator}{\var{plan{\ac}operators{\ac}$S_{need}${\ac}c}}
\bodysep
    \key{choose} a step $S_{add}$ from \var{operators} or \noprog{Steps}({\ts}\var{plan}) that has $c$ as an effect
    \key{if} there is no such step \key{then fail} 
    add the causal link $\cl{S_{add}}{c}{S_{need}}$ to \noprog{Links}({\ts}\var{plan})
    add the ordering constraint $S_{add} \before S_{need}$ to \noprog{Orderings}({\ts}\var{plan})
    \key{if} $S_{add}$ is a newly added step from \var{operators} \key{then}
          add $S_{add}$ to \noprog{Steps}({\ts}\var{plan})
          add $Start \before S_{add} \before Finish$ to \noprog{Orderings}({\ts}\var{plan})
\fnsep
\proc{Resolve-Threats}{\var{plan}}
\bodysep
    \key{for each} $S_{threat}$ that threatens a link $\cl{S_i}{c}{S_j}$ in \noprog{Links}({\ts}\var{plan}) \key{do}
          \key{choose} either
                {\it Demotion:} Add $S_{threat}\before S_i$ to \noprog{Orderings}({\ts}\var{plan})
                {\it Promotion:} Add $S_j \before S_{threat}$ to \noprog{Orderings}({\ts}\var{plan})
          \key{if not} \prog{Consistent}({\ts}\var{plan}) \key{then fail}
    \key{end}
}
