Refactored generated locals to a separate object, some work to preserve comments in rewrite