Updated the examples and fixed a couple of bugs