Simplified logic.  Added prologue form.