Initial checkin.
Also some cleanup of the logging code and some examples.