Added an example of how to use this as a library.

Small bug fixes.