rewrite api to make it like writing html