Fixed a few bugs.
Added an example.