Half-rewrite of procedural.scm.