updated examples; code cleanup