Added a new example and fixed some bugs.