updated examples with logging