add CDS phase aware translation and Lua improvements