Rewrite helper functions