rewrite functions in qdq