added example and fixed some issues