Final commit of the Bug version.

Code has been refactored into a joint Bug/Fido version with shared
parts.