Rewire sample

Just a rewrite of sample with "new" API