Improve sample + small API changes