flagged functions to rewrite