encryption code cleanup
form2 fix for replace