first version
added example
fixed some bugs