rewrite demo based on the new interface