First step to optimized rewriting