Added examples, fixed some bugs