several tweaks, moved around some examples, fixed memory leak