refatcor the code
add api to notes