Initial import of carli's changes to XCNCIP2.php
First steps to "consortialize" (see pull request #166).
Fixed doc comments.
Style fixes.
Fixed unused code problems.