example code reorganize, add comments