Dark canary code patches

A bunch of patches based on comments on the dark canary code.