do refactorings for lambda capture implementation

- reduce nest
- split long function to some short functions
- remove useless code
add more sample for lambda captures
update an example in README