Minor patching, mostly switching a printf to a pabort, so it correctly exits if you pass bad parameters. Also, added a newline to one of the debug statements.