refactory and add example
add docs