fn_clear added for fn_generate_key