Cleanup some error handling, fix a bug in CompleteCodeSystemVersion
resolution.  A few changes to allow the code to work inside the
exist-service implementation.