Note: Called by the Lead template, which guarantees that "width" and "height" parameters, and one of "next" and "result" are always present.