lots of fixes, documentation update and added example