Added a new example and fixed some minor bugs.