Added examples and fixed bugs