Update examples and clean up code.