rewrite most function to web