Refactor Generated Code