rewrite some functionality