Comments added. Problem on refinement fixed. The newly generated context do retype constants. Also do not regenerate constant