small API improvement and example improvements