ceanup encryption code, improved return codes