finish middleware code
add comment to code
update usage