RAIN update
code rearrange