* remove duplicate code
* implement send api