added example app and made library more flexible