fixed some memory leaks; added 2 more examples