Fix README, refactor sample, improve style
Make code more consistent