p26 complete - non-tail recursive version