rewrite basic components with cpp