slightly more flexible api, added two examples