rewrite examplecode