clarify and simplify

improve structure and comments in the example code