rewriting feature generation